<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Grid布局</title>
    <style>
        .parent {
            width: 400px;
            height: 400px;
            margin: 50px auto;
            background-color: cyan;

            display: grid;
            grid-template-rows: repeat(3, 1fr);
            grid-template-columns: repeat(3, 1fr);

            /* 单元格内的对齐 */

            /* justify-items：水平  align-items：垂直 */
            /* 能取得值：start|end|center */
            justify-items: center;
            align-items: center;

            /* 以上的简写 */
            /* place-items: 垂直方向 水平方向; */
            /* place-items: center center; */
            place-items: center;
        }

        .child {
            /* 由于默认stretch，为了避免观察不到效果，需要指定固定的宽高 */
            width: 40px;
            height: 40px;
            background-color: lightblue;
        }
    </style>
</head>

<body>

    <div class="parent">
        <div class="child item01">1</div>
        <div class="child item02">2</div>
        <div class="child item03">3</div>
        <div class="child item04">4</div>
        <div class="child item05">5</div>
        <div class="child item06">6</div>
        <div class="child item07">7</div>
        <div class="child item08">8</div>
        <div class="child item09">9</div>
    </div>

</body>

</html>